const XLSX = require('xlsx');
const gPath = require('path');
 
function readExcelFile(filePath) {
    // 读取文件
    const workbook = XLSX.readFile(filePath);
    
    // 获取第一个工作表的名字
    const sheetName = workbook.SheetNames[0];
    console.log("##",sheetName);
    
    // 获取工作表数据
    const worksheet = workbook.Sheets[sheetName];
    
    // 将工作表数据转换为 JSON 格式
    const data = XLSX.utils.sheet_to_json(worksheet);
    
    return data;
}
 
const filePath = gPath.join(__dirname, 'xlsx', 'NFT_words.xlsx');
const data = readExcelFile(filePath);
// console.log(data);
var keys = Object.keys(data);
// console.log("# line-count:", keys.length);
// console.log(data['0']);

//! 拆分
const flagLine = data['0'];
const flag2Map = {};

function cacheLine(lineFlag, lineData){
    const lineKeys = Object.keys(lineFlag);
    for(let i = 0; i < lineKeys.length; ++i){
        console.log(lineKeys[i]);
    }
}

for(let i = 0; i <keys.length; ++i){
    var tmpKey = `${keys[i]}`;
    if('1' != tmpKey &&  '0' != tmpKey){
        const tmpLine = data[tmpKey];
        // console.log(tmpLine);
        cacheLine(tmpLine);
    }
}




